﻿/*
{
"状态":1,
"名称":"删除-用户信息",
"作者":"陈泽椿",
"创建时间":"2018-06-30",
"功能":"删除-用户信息",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/

declare @sql varchar(max)
declare @keys varchar(max)
set @keys = '{keys}'


set @sql = '

IF EXISTS(SELECT 1 FROM y_user where user_key in ({ids}) AND [user_id]=''admin'') 
begin
    RAISERROR (''SQL:admin不允许删除'', 16 ,1 ) ; 
	return 
end 

delete y_user where user_key in ({ids})
delete y_role_user WHERE user_key ({ids})
'

set @sql =REPLACE(@sql,'{ids}',@keys)

exec(@sql)
